Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

优先选择偏好类型数据源,不需要等其他源查询完毕 #1002

Merged
merged 10 commits into from
Sep 30, 2024

Conversation

NieR4ever
Copy link
Member

resolve #816

@Him188 Him188 self-requested a review September 24, 2024 09:26
@Him188 Him188 added the s: media 子系统: 数据源基础 label Sep 24, 2024
Copy link
Member

@Him188 Him188 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

需要增加测试, 当一个源完成后就立即选择

@NieR4ever
Copy link
Member Author

不清楚怎么测试,感觉比较难观察 hasCompleted 的变化

Copy link
Member

@Him188 Him188 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, 但是需要有 test 确保以后不会 regress

需要测试:

  • prefer BT 时, WEB 完成了, 应当继续等待
  • prefer BT 时, BT 完成了, 应当自动选择
  • prefer BT 时, 没有启用 BT 源, 会怎么样?
  • prefer BT 时, 但 BT 没有搜到东西, 是什么行为?
  • 没有 preferefence, BT 完成了但 web 没有完成, 应当继续等待
  • 没有 preferefence, 都完成了, 自动选择 (应该是现有 case?)

@Him188
Copy link
Member

Him188 commented Sep 25, 2024

test 中协程是单线程的, 你可以控制的

在数据源实现中, 用 CompletableDeferred<Unit> 来等待. 然后你在后面可以 deferred.complete(Unit), 然后 runCurrent() 让 fetch 的协程跑.

@Him188 Him188 enabled auto-merge (squash) September 29, 2024 15:16
@Him188 Him188 merged commit ffcf03d into main Sep 30, 2024
6 checks passed
@Him188 Him188 deleted the NieR/auto-select branch September 30, 2024 00:29
@Him188 Him188 added this to the 3.11.0 milestone Sep 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s: media 子系统: 数据源基础
Projects
None yet
Development

Successfully merging this pull request may close these issues.

优先选择在线源时,不需要等BT源查询完毕
2 participants